package com.smartEdu.module.thrift.server.helloworld;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import com.smartEdu.exception.SystemInitException;
import com.smartEdu.module.thrift.common.BaseTServer;
import com.smartEdu.module.thrift.common.ThriftServer;

@Component
public class HelloWorldServer extends BaseTServer {
	private final static String thriftProjectName = "helloworld";
	
	public HelloWorldServer() {
		super(thriftProjectName.toLowerCase());
	}

	@Autowired
	@Qualifier(value="TThreadedSelectorServer")
	private ThriftServer server;

	@Override
	public void init() throws SystemInitException {
		try {
			initProcessor(server);
		} catch (Exception e) {
			throw new SystemInitException("初始化thrift项目"+thriftProjectName+"失败",e);
		}
	}

	@Override
	public void stop() {
		stop(server);
	}

}
